package com.authine.cloudpivot.ext.constants;

import java.math.BigDecimal;
import java.util.*;

/**
 * creator by: ivan
 */
public class TaxRate {


    public final static BigDecimal Tax_Rate_0_06 = new BigDecimal("0.06");
    public final static BigDecimal Tax_Rate_0_09 = new BigDecimal("0.09");
    public final static BigDecimal Tax_Rate_0_10 = new BigDecimal("0.10");
    public final static BigDecimal Tax_Rate_0_13 = new BigDecimal("0.13");
    public final static BigDecimal Tax_Rate_0_16 = new BigDecimal("0.16");
    private static Map<String, BigDecimal> rates = new LinkedHashMap<>();
    private static Map<String, BigDecimal> ratesApi = new LinkedHashMap<>();
    private static List<BigDecimal> ratesListApi = new ArrayList<>();

    static {
        /**
         * API用
         */
        ratesListApi.add(Tax_Rate_0_06);
        ratesListApi.add(Tax_Rate_0_09);
        ratesListApi.add(Tax_Rate_0_10);
        ratesListApi.add(Tax_Rate_0_13);
        ratesListApi.add(Tax_Rate_0_16);


        rates.put("6%", Tax_Rate_0_06);
        rates.put("9%", Tax_Rate_0_09);
        rates.put("10%", Tax_Rate_0_10);
        rates.put("13%", Tax_Rate_0_13);
        rates.put("16%", Tax_Rate_0_16);
        /**
         * API用
         */
        ratesApi.put("six", Tax_Rate_0_06);
        ratesApi.put("nine", Tax_Rate_0_09);
        ratesApi.put("ten", Tax_Rate_0_10);
        ratesApi.put("thirteen", Tax_Rate_0_13);
        ratesApi.put("sixteen", Tax_Rate_0_16);

    }

    public static List<BigDecimal> getRatesListApi() {

        return ratesListApi;
    }

    public static Map<String, BigDecimal> listAPI() {

        return ratesApi;
    }

    public static Set<String> listTaxRateAPI() {

        return ratesApi.keySet();
    }

    public static Collection<BigDecimal> listTaxRateValueaAPI() {

        return ratesApi.values();
    }

    public static Map<String, BigDecimal> list() {

        return rates;
    }


    public static Set<String> listTaxRate() {

        return rates.keySet();
    }

    public static Collection<BigDecimal> listTaxRateValue() {

        return rates.values();
    }

    public static BigDecimal get(String text) {

        return rates.get(text);
    }
}
